import { BasicColumn, FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '索引健康',
    align: 'center',
    dataIndex: 'health',
  },
  {
    title: '索引状态',
    align: 'center',
    dataIndex: 'status',
  },
  {
    title: '索引名',
    align: 'center',
    dataIndex: 'index',
  },
  {
    title: '文档数',
    align: 'center',
    dataIndex: 'docsCount',
  },
  {
    title: '文档删除数',
    align: 'center',
    dataIndex: 'docsDeleted',
  },
  {
    title: '索引大小',
    align: 'center',
    dataIndex: 'storeSize',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'queryStr',
    label: '索引名',
    component: 'JInput',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'indexName',
    label: '索引名',
    component: 'Input',
    required: true,
  },
  {
    field: 'numberOfShards',
    label: '分片数',
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'numberOfReplicas',
    label: '副本数',
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'type',
    label: '类型',
    component: 'Input',
    defaultValue: 'JSON',
    required: true,
  },
  {
    label: '映射JSON',
    field: 'mappingsSource',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入mappings的JSON内容',
      autoSize: {
        minRows: 8,
        maxRows: 8,
      },
    },
  },
];
